package com.nc.delivery_project.server.domain;

/**
 * Created by miroshnik on 01.12.14.
 */
public class NaturalPerson extends User {
    
    private String fullName;

    private String tel;
    private int naturalPersonId;

    public NaturalPerson(int personId, int userId, String fullName, String tel) {
        super(userId);
        this.fullName = fullName;
        this.tel = tel;
        this.naturalPersonId = personId;
    }

    public NaturalPerson(int userId, String fullName, String tel) {
        this(0, userId, fullName, tel);
    }

    public NaturalPerson() {

    }

    public String getFullName() {
        return fullName;
    }

    public void setFullName(String fullName) {
        this.fullName = fullName;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public int getNaturalPersonId() {
        return naturalPersonId;
    }

    public void setNaturalPersonId(int naturalPersonId) {
        this.naturalPersonId = naturalPersonId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof NaturalPerson)) return false;
        if (!super.equals(o)) return false;

        NaturalPerson that = (NaturalPerson) o;

        if (fullName != null ? !fullName.equals(that.fullName) : that.fullName != null) return false;
        if (tel != null ? !tel.equals(that.tel) : that.tel != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = super.hashCode();
        result = 31 * result + (fullName != null ? fullName.hashCode() : 0);
        result = 31 * result + (tel != null ? tel.hashCode() : 0);
        return result;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("NaturalPerson{");
        sb.append("fullName='").append(fullName).append('\'');
        sb.append(", tel='").append(tel).append('\'');
        sb.append(", naturalPersonId=").append(naturalPersonId);
        sb.append(", email=").append(getEmail());
        sb.append('}');
        return sb.toString();
    }
}
